package com.qpx.eurekamongodb.controller;


import com.qpx.dto.LogDto;
import com.qpx.eurekamongodb.entity.LogEntity;
import com.qpx.eurekamongodb.service.LogService;
import com.qpx.vo.ResultEntity;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LogController {


    @Autowired
    LogService logService;

    @RequestMapping("/log/save")
    public ResultEntity save(@RequestBody LogDto logDto){
        LogEntity logEntity = new LogEntity();
        BeanUtils.copyProperties(logDto,logEntity);
        logService.save(logEntity);
        return ResultEntity.ok();
    }

    @RequestMapping("/log/find")
    public ResultEntity findLog(@RequestBody LogDto logDto){
        return logService.find(logDto);
    }
}
